import FsStorage from './storage/FsStorage';
import LocalStorage from './storage/LocalStorage';
import CacheKeys from '@/config/cache';

export default class Cache {

    private static instance: Cache;

    private mFsStorage: FsStorage<CacheKeys>;
    private mLocalStorage: LocalStorage<CacheKeys>;

    private constructor() {
        this.mFsStorage = new FsStorage();
        this.mLocalStorage = new LocalStorage();
    }

    public static getFsCache() {
        return this.getInstance().mFsStorage;
    }
    public static getLocalCache() {
        return this.getInstance().mLocalStorage;
    }

    private static getInstance() {
        if (!this.instance) {
            this.instance = new Cache();
        }
        return this.instance;
    }
}